class UserController < ApplicationController
   def edit
    @user = current_user
  end

  def update
    @user = User.find(current_user.id)
    if @user.update_attributes(params[:user])
      # Sign in the user by passing validation in case his password changed
      sign_in @user, :bypass => true
      Notifier.gmail_message(@user).deliver
      redirect_to root_path, :notice => "Your message has been sent."
    else
      render "edit"
    end
  end
end
